package generic;

/**
 * @description:
 * @Author yyp
 * @time 2022/3/36
 */
public class Generic03 {
    public static void main(String[] args) {
        Person<String> person1 = new Person<String>("test");
        person1.show();
        System.out.println(person1.toString());
        Person<Integer> person2 = new Person<Integer>(20);
        person2.show();
        System.out.println(person2.toString());
    }
}

class Person<E>{
    E a;

    public E getA() {
        return a;
    }

    public void setA(E a) {
        this.a = a;
    }

    public void show(){
        System.out.println(a.getClass());
    }

    public Person(E a) {
        this.a = a;
    }

    @Override
    public String toString() {
        return "Person{" +
                "a=" + a +
                '}';
    }
}
